// import echarts from "echarts";
// import * as echarts from "echarts/core";
// 按需引入方式
import echarts from '@/views/package/echarts/components/BaseEcharts/utils/echarts'
export function getOptions(){
    const indicator = [];
const typeList = ['1F', '2F', '3F', '4F', '5F', '6F', '7F', '8F'];
const number = [92.04, 81.01, 81.17, 92.9, 93.74, 93.77, 91.51, 90.25];
const type = '其他指标';
typeList.forEach((item) => {
  indicator.push({
    text: item,
    min: 0,
    max: 100
  });
});

const option = {
  tooltip: {
    // confine: true,
    backgroundColor: 'transparent',
    formatter: (obj) => {
      let str =
        '<div style="padding: 7px 14px; background: #fff; box-shadow: 2px 2px 7px 0px rgba(0, 0, 0, 0.19); border-radius: 10px; border: solid 1px; font-size: 18px">';

      typeList.forEach((item, index) => {
        const value = obj.value[index];
        let showValue = value;
        if (type === '维度指标') {
          if (showValue === 100) {
            showValue = 'A';
          } else if (showValue === 75) {
            showValue = 'B';
          } else if (showValue === 50) {
            showValue = 'C';
          } else {
            showValue = value;
          }
        }

        str += `<p style="height: 25px; lineHeight: 25px; color: #323232">
                    <i style="display: inline-block; width: 16px; height: 16px; border-radius: 8px; background: ${obj.color}; vertical-align: middle"></i>
                    ${item}: ${showValue}
                  </p>`;
      });
      str += '</div>';

      return str;
    }
  },
  polar: {
    center: ['50%', '50%'],
    radius: '70%'
  },
  radar: {
    shape: 'circle',
    center: ['50%', '50%'],
    radius: '70%',
    indicator: indicator,
    name: {
      color: '#585757',
      fontSize: 18
    },
    splitNumber: 4,
    splitArea: {
      show: false
    },
    axisLine: {
      show: false
    },
    splitLine: {
      lineStyle: {
        color: '#a2acbc'
      }
    }
  },
  angleAxis: {
    type: 'category',
    minInterval: 1,
    boundaryGap: false,
    clockwise: false,
    axisTick: {
      show: false
    },
    axisLabel: {
      show: false
    },
    axisLine: {
      show: false
    },
    splitLine: {
      show: false
    }
  },
  radiusAxis: {
    min: 0,
    max: 100,
    interval: 25,
    splitLine: {
      show: false
    },
    axisTick: {
      show: false
    },
    axisLine: {
      show: false
    },
    axisLabel: {
      fontSize: 12,
      color: '#585757',
      align: 'center',
      margin: -5,
      formatter: (value) => {
        // console.log('axisLabel',value);
        if (type === '维度指标') {
          if (value === 100) {
            return 'A';
          }
          if (value === 75) {
            return 'B';
          }
          if (value === 50) {
            return 'C';
          }
        } else {
          return value;
        }
      }
    }
  },
  series: [
    {
      name: '得分',
      type: 'radar',
      symbolSize: 9,
      color: '#004892',
      areaStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: 'rgba(0,72,146,.7)'
          },
          {
            offset: 1,
            color: 'rgba(0,72,146,.3)'
          }
        ])
      },
      data: [{ value: number }]
    }
  ]
};
return option
}